home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Directorty Opus 5 - Magellan
/
Opus 5 - Magellan.iso
/
Extras
/
DLGoodies
/
emacs.dopus5
< prev
next >
Wrap
Text File
|
1996-08-29
|
3KB
|
117 lines
/*
* Load selected files and directories from a DOpus5 lister into Emacs.
* If an Emacs port is found, entries are loaded into a running Emacs.
* Otherwise Emacs is invoked first, using appropriate stack size.
*
* V1.0 (20.7.96) by David Lübbren.
*
* Note: As I start the 'fifo-handler' in my User-startup I only test
* for its presence in this script.
*
* Tested using Emacs 18.59 Amiga port 1.29DG, DirectoryOpus 5.11 and
* fifo.library 38.2.
*
* Call: Arexx DOpus5:Arexx/emacs.dopus5 {Qp}
*
*/
StackSize = 60000
EmacsPort = 'EMACS1'
FifoPort = 'FIFO-PORT'
EmacsCmd = 'Run <nil: >nil: GNUEmacs:temacs'
DefaultDir = 'ram:'
message = 'Loading into Emacs...'
lf = '0a'x
OPTIONS RESULTS
PARSE ARG dopusport
IF dopusport ~= "" THEN ADDRESS VALUE dopusport
ELSE DO
SAY "No DOpus running !"
EXIT
END
SourcePath = DefaultDir
NoLister = 1
lister query source
IF rc = 0 THEN DO
PARSE VAR result handle .
NoLister = 0
lister set handle busy on
lister query handle path
IF rc = 0 THEN DO
SourcePath = STRIP(result, 'B', '"')
lister query handle selentries stem Entry.
END
END
IF ~SHOW('Ports', EmacsPort) THEN DO
IF ~SHOW('Ports', FifoPort) THEN DO
/*
* ADDRESS COMMAND 'Run <NIL: >NIL: L:fifo-handler'
* ADDRESS COMMAND 'Waitport' FifoPort
*/
dopus request '"Warning: fifo-handler not running 'lf' no external processes runnable" Ok'
END
PRAGMA('Stack', StackSize)
PRAGMA('Directory', SourcePath)
ADDRESS COMMAND
EmacsCmd
'WaitForPort' EmacsPort
ADDRESS
IF rc = 5 THEN DO
dopus request '"Can''t find emacs port '''EmacsPort'''" Cancel'
SIGNAL quitit
END
END
IF NoLister = 0 & Entry.count > 0 THEN DO
lister set handle progress Entry.count message
lister set handle title message
lister refresh handle full
DO i=0 TO Entry.count-1
lister query handle abort
IF result THEN
SIGNAL quitit
lister set handle progress count i+1
lister set handle progress name Entry.i
ADDRESS VALUE EmacsPort
'(find-file "' || SourcePath || Entry.i || '")'
ADDRESS
lister select handle '"' || Entry.i || '"' off
lister refresh handle
END
END
/*
* Uniconify Emacs and pull up front.
*/
ADDRESS VALUE EmacsPort
'(if (car (amiga-get-window-geometry)) (amiga-iconify))'
'(amiga-window-to-front)'
'(amiga-activate-window)'
ADDRESS
SIGNAL quitit
quitit:
IF NoLister = 0 THEN DO
lister set handle title
lister refresh handle full
lister set handle busy off
END
EXIT